package main

import "fmt"

type SayHello interface {
	say()
}

type Chinese struct {
}

func (c Chinese) say() {
	fmt.Printf(" 你好 ！ \n")
}

func (c Chinese) niuyangge() {
	fmt.Printf(" 正在扭秧歌 \n")
}

type American struct {
}

func (a American) say() {
	fmt.Printf("say：hello！ \n")
}

func (a American) hanbaobao() {
	fmt.Printf("hanbaobao！ \n")
}

// 通用接口
func greet(s SayHello) {
	switch s.(type) {
	case Chinese:
		ch := s.(Chinese)
		ch.niuyangge()
	case American:
		am := s.(American)
		am.hanbaobao()
	default:
		s.say()
	}
}

func main() {
	//chinese := new(Chinese)
	american := American{}
	greet(american)
}
